package com.fuqi.android.zhongcai.utils.dic.impl;

import com.fuqi.android.zhongcai.utils.dic.IField;

import java.io.Serializable;

public class Field implements IField, Serializable {
	private static final long serialVersionUID = -539887646137077865L;
	// /////////////////////////////////////////////////////////////////////
	// 以下是表字段定义相关属性
	// /////////////////////////////////////////////////////////////////////

	/**
	 * 
	 */

	// 字段唯一标识
	private long id = -1;

	// 字段表ID
	private long tableId = -1;

	// 字段 名称
	private String fieldName = "";

	// 字段 中文名
	private String label = "";

	// 字段 可编辑
	private boolean editable = false;

	// 字段 是否可空
	private boolean nullable = true;

	// 字段 长度
	private int length = 0;

	// 字段 类型
	private int fieldType = 0;

	// 关联字段
	private long fieldId;

	// 字段 值来源
	private int functionNo = -1;

	// /////////////////////////////////////////////////////////////////////
	// 以下是UI显示相关属性
	// /////////////////////////////////////////////////////////////////////

	// 字段值 展示方式 0: 无点击即显示 1:点击后当前页面编辑 2：点击后跳转activity 3:点击后跳转popupWindow
	private int showType = 0;

	// 字段 输入方式  -2:未定义类型 -1:原本类型 0：文本 1：多行文本 2：整型 3：浮点型 4：长日期型 5：短日期型 6：父表信息选择7：枚举类型 8：验证码 9:列表① 10:列表② 11：列表③
	private int inputType = -1;

	// showType=0 &&inputType=0 时，inputStyle值：1: PHONESTYLE 2:EMAILSTYLE
	// 3:NUMBERSTYLE 4:DATATIMESTYLE 5:TEXTSTYLE 6:PASSWORDSTYLE 7:URLSTYLE
	// 8:PSDSTYLE
	private int inputStyle = 0;

	// 字段分组显示
	private int groupId = 0;

	// 字段排序号
	private int order = 0;

	// 字段是否显示
	private boolean canShow = true;

	// 布局器中显示的长度
	private int layoutLen = 0;

	public Field() {

	}

	/**
	 * 构建一个调用数据字典的Field
	 * @param fieldName 与数据字典对应的字段名
	 * @param functionNo 功能号
	 */
	public Field(String fieldName, int functionNo) {
		this.fieldName = fieldName;
		this.functionNo = functionNo;
	}
	
	public Field(String fieldName, String label, int order) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
	}
	
	public Field(String fieldName, String label, int order,boolean canshow) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
		this.canShow = canshow;
	}

	public Field(String fieldName, String label, int order,int showtype) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
		this.showType = showtype;
	}

	public Field(String fieldName, String label, int order,int showtype,int inputtype,boolean editable) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
		this.showType = showtype;
		this.inputType = inputtype;
		this.editable = editable;
	}
	
	public Field(String fieldName, String label, int order,int showtype,int inputtype,boolean editable,boolean canshow) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
		this.showType = showtype;
		this.inputType = inputtype;
		this.editable = editable;
		this.canShow = canshow;
	}
	
	public Field(String fieldName, String label, int order,int showtype,int inputtype,boolean editable,int inputStyle) {
		this.fieldName = fieldName;
		this.label = label;
		this.order = order;
		this.showType = showtype;
		this.inputType = inputtype;
		this.editable = editable;
		this.inputStyle = inputStyle;
	}
	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getLayoutLen() */
	@Override
	public int getLayoutLen() {
		return layoutLen;
	}

	public void setLayoutLen(int layoutLen) {
		this.layoutLen = layoutLen;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#isCanShow() */
	@Override
	public boolean canShow() {
		return canShow;
	}

	public void setCanShow(boolean canShow) {
		this.canShow = canShow;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getOrder() */
	@Override
	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getGroupId() */
	@Override
	public int getGroupId() {
		return groupId;
	}

	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getId() */
	@Override
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getTableId() */
	@Override
	public long getTableId() {
		return tableId;
	}

	public void setTableId(long tableId) {
		this.tableId = tableId;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getShowType() */
	@Override
	public int getShowType() {
		return showType;
	}

	public void setShowType(int showType) {
		this.showType = showType;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getLabel() */
	@Override
	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#isEditable() */
	@Override
	public boolean isEditable() {
		return editable;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#isNullable() */
	@Override
	public boolean isNullable() {
		return nullable;
	}

	public void setNullable(boolean nullable) {
		this.nullable = nullable;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getLength() */
	@Override
	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getInputType() */
	@Override
	public int getInputType() {
		return inputType;
	}

	public void setInputType(int inputType) {
		this.inputType = inputType;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getInputStyle() */
	@Override
	public int getInputStyle() {
		return inputStyle;
	}

	public void setInputStyle(int inputStyle) {
		this.inputStyle = inputStyle;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getFunctionNo() */
	@Override
	public int getFunctionNo() {
		return functionNo;
	}

	public void setFunctionNo(int functionNo) {
		this.functionNo = functionNo;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getFieldName() */
	@Override
	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getFieldId() */
	@Override
	public long getFieldId() {

		return this.fieldId;
	}

	public void setFieldId(long fieldId) {
		this.fieldId = fieldId;
	}

	/* (non-Javadoc)
	 * 
	 * @see com.cjsc.platform.buz.dic.IField#getFieldId() */
	@Override
	public int getFieldType() {
		return this.fieldType;
	}

	public void setFieldType(int fieldType) {
		this.fieldType = fieldType;
	}

	public String toString() {
		String r = "";
		r += " fieldName=" + this.fieldName;
		r += " fieldLabel=" + this.label;
		r += " id=" + this.fieldId;
		r += " fieldType=" + this.fieldType;
		r += " order=" + this.order;
		r += " showType=" + this.showType;
		r += " inputType=" + this.inputStyle;
		r += " inputStyle=" + this.inputStyle;
		r += " functionNo=" + this.functionNo;
		return r;

	}
}